<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>类与继承</title>
<body>
    <div></div>
    <script>
      function getType(obj){
         return Object.prototype.toString.call(obj).slice(8,-1);
        //  Object.prototype.toString.call(obj) 执行Object原型上toString 方法 用当前obj 冒充函数中的this
        // slice(8,-1); 把字符从第8个到倒数第一个 截取出来
      }
      console.log(getType({}))
      console.log(getType([]))
      console.log(getType("abc"))
      console.log(getType(123))
    </script>

</body>
</html>